package game.entities;

import game.InputHandler;
import game.gfx.SpriteSheet;
import game.level.Level;


public class Player extends Entity
{
	InputHandler input;
	int xa = 0;
	int ya = 0;
	int xPos;
	int yPos;
	int[][] playerSprite;
	int spriteX = 0;
	int spriteY = 2;
	int speed = 3;
	
	public Player(Level level, int x, int y, InputHandler input, SpriteSheet sheet)
	{
		super(level, x, y, sheet);
		this.input = input;
		
		playerSprite = new int[8][8];
	}

	public void updatePosition()
	{
		if (input.up.isPressed()) ya--;
		if (input.down.isPressed()) ya++;
		if (input.left.isPressed()) xa--;
		if (input.right.isPressed()) xa++;
		
		if(!hasCollided(xPos, yPos))
		{
			xPos = x + xa * speed;
			yPos = y + ya * speed;
			System.out.println(xPos + " " + yPos);
		}
	}
	
	public int getXPos()
	{
		return xPos;
	}
	
	public int getYPos()
	{
		return yPos;
	}
	
	public int[][] getPlayerGraphic()
	{
		playerSprite = sheet.getTileData(spriteX, spriteY);
		return playerSprite;
	}
	
	public boolean hasCollided(int xPos, int yPos)
	{
		int xMin = 1;
		int xMax = 6;
		int yMin = 0;
		int yMax = 7;
		
		return false;
	}


}
